package cn.ismartv.viewpagerindicator;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by huaijie on 1/7/16.
 */
public class IndicatorFragmentPagerAdapter extends FragmentPagerAdapter implements IconPagerAdapter {
    private List<FragmentPager> fragmentPagers;


    public IndicatorFragmentPagerAdapter(FragmentManager fm, List<FragmentPager> fragmentPages) {
        super(fm);
        this.fragmentPagers = fragmentPages;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentPagers.get(position).getFragment();
    }

    @Override
    public int getCount() {
        return fragmentPagers.size();
    }

    @Override
    public int getIconResId(int index) {
        return fragmentPagers.get(index).getIconResId();
    }

    public List<FragmentPager> getFragmentPagers() {
        return fragmentPagers;
    }

}
